﻿using RpcHelper;
using RpcModel.Model;

using Wedonek.RpcStore.Service.Model;

namespace Wedonek.RpcStore.Service.DAL
{
        internal class ServerLimitConfigDAL : SqlExecHelper.SqlBasicClass
        {
                public ServerLimitConfigDAL() : base("ServerLimitConfig")
                {

                }
                public void Add(AddServerLimitConfig add)
                {
                        base.Insert(add);
                }
                public void Set(long serverId, ServerLimitConfig config)
                {
                        if(!base.Update(config, "ServerId", serverId))
                        {
                                throw new ErrorException ("rpc.server.limit.config.set.error");
                        }
                }
                public void Drop(long serverId)
                {
                        if(!this.Drop("ServerId", serverId))
                        {
                                throw new ErrorException ("rpc.server.limit.config.drop.error");
                        }
                }
                public ServerLimitConfig GetConfig (long serverId)
                {
                        return this.GetRow<long, ServerLimitConfig> ("ServerId", serverId);
                }
        }
}
